<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>创建StorageClass | 十三不知</title><meta name="keywords" content="Kubernetes,文件挂载"><meta name="author" content="张十三"><meta name="copyright" content="张十三"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="安装Helm3 部署客户端   在任意一个master节点执行以下命令   根据系统下载所需版本 1curl -L -o helm-v3.2.4-linux-amd64.tar.gz https:&#x2F;&#x2F;file.choerodon.com.cn&#x2F;kubernetes-helm&#x2F;v3.2.4&#x2F;helm-v3.2.4-linux-amd64.tar.gz">
<meta property="og:type" content="article">
<meta property="og:title" content="创建StorageClass">
<meta property="og:url" content="http://zuori.gitee.io/zaker/2021/02/25/%E9%85%8D%E7%BD%AEStorageClass/index.html">
<meta property="og:site_name" content="十三不知">
<meta property="og:description" content="安装Helm3 部署客户端   在任意一个master节点执行以下命令   根据系统下载所需版本 1curl -L -o helm-v3.2.4-linux-amd64.tar.gz https:&#x2F;&#x2F;file.choerodon.com.cn&#x2F;kubernetes-helm&#x2F;v3.2.4&#x2F;helm-v3.2.4-linux-amd64.tar.gz">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg">
<meta property="article:published_time" content="2021-02-25T11:46:36.000Z">
<meta property="article:modified_time" content="2021-03-26T01:40:32.871Z">
<meta property="article:author" content="张十三">
<meta property="article:tag" content="Kubernetes">
<meta property="article:tag" content="文件挂载">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg"><link rel="shortcut icon" href="https://gitee.com/zuori/kaiscript/raw/master/images/20210325203813.png"><link rel="canonical" href="http://zuori.gitee.io/zaker/2021/02/25/%E9%85%8D%E7%BD%AEStorageClass/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/zaker/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/zaker/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: {"limitCount":50,"languages":{"author":"作者: 张十三","link":"链接: ","source":"来源: 十三不知","info":"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = { 
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-03-26 09:40:32'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    })(window)</script><meta name="generator" content="Hexo 5.4.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src="https://gitee.com/zuori/kaiscript/raw/master/images/20210325192506.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/zaker/archives/"><div class="headline">文章</div><div class="length-num">13</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/zaker/tags/"><div class="headline">标签</div><div class="length-num">11</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/zaker/categories/"><div class="headline">分类</div><div class="length-num">4</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/zaker/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/zaker/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/zaker/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/zaker/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/zaker/">十三不知</a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/zaker/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/zaker/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/zaker/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/zaker/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">创建StorageClass</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2021-02-25T11:46:36.000Z" title="发表于 2021-02-25 19:46:36">2021-02-25</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-03-26T01:40:32.871Z" title="更新于 2021-03-26 09:40:32">2021-03-26</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/zaker/categories/%E4%BA%91%E5%8E%9F%E7%94%9F/">云原生</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="创建StorageClass"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1>安装Helm3</h1>
<h2 id="部署客户端">部署客户端</h2>
<ul>
<li>
<p>在任意一个master节点执行以下命令</p>
<ol>
<li>
<p>根据系统下载所需版本</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">curl -L -o helm-v3.2.4-linux-amd64.tar.gz https:&#x2F;&#x2F;file.choerodon.com.cn&#x2F;kubernetes-helm&#x2F;v3.2.4&#x2F;helm-v3.2.4-linux-amd64.tar.gz</span><br></pre></td></tr></table></figure>
</li>
<li>
<p>解压压缩包（以linux-amd64为例）</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tar -zxvf helm-v3.2.4-linux-amd64.tar.gz</span><br></pre></td></tr></table></figure>
</li>
<li>
<p>将文件移动到PATH目录中（以linux-amd64为例）</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo mv linux-amd64&#x2F;helm &#x2F;usr&#x2F;bin&#x2F;helm</span><br></pre></td></tr></table></figure>
</li>
</ol>
</li>
</ul>
<h2 id="验证部署">验证部署</h2>
<ul>
<li>
<p>执行命令，出现以下信息即部署成功。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ helm version</span><br><span class="line">version.BuildInfo&#123;Version:&quot;v3.2.4&quot;, GitCommit:&quot;0ad800ef43d3b826f31a5ad8dfbb4fe05d143688&quot;, GitTreeState:&quot;clean&quot;, GoVersion:&quot;go1.13.12&quot;&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<h1>建立StorageClass</h1>
<h2 id="创建-NFS-服务器">创建 NFS 服务器</h2>
<p>NFS 允许系统将其目录和文件共享给网络上的其他系统。通过 NFS，用户和应用程序可以访问远程系统上的文件，就象它们是本地文件一样。</p>
<h3 id="安装nfs-utils">安装nfs-utils</h3>
<ul>
<li>
<p>在集群每一个节点安装<code>nfs-utils</code></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo yum install -y nfs-utils</span><br></pre></td></tr></table></figure>
</li>
</ul>
<h3 id="配置nfs-server">配置nfs-server</h3>
<ul>
<li>
<p>创建共享目录</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mkdir -p &#x2F;u01&#x2F;nfs</span><br></pre></td></tr></table></figure>
</li>
<li>
<p>编辑<code>/etc/exports</code>文件添加需要共享目录，每个目录的设置独占一行，编写格式如下：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">NFS共享目录路径 客户机IP段(参数1,参数2,...,参数n)</span><br></pre></td></tr></table></figure>
</li>
<li>
<p>例如：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">&#x2F;u01&#x2F;nfs 172.22.2.222&#x2F;16(rw,sync,insecure,no_subtree_check,no_root_squash)</span><br></pre></td></tr></table></figure>
<table>
<thead>
<tr>
<th style="text-align:left">参数</th>
<th style="text-align:left">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">ro</td>
<td style="text-align:left">只读访问</td>
</tr>
<tr>
<td style="text-align:left">rw</td>
<td style="text-align:left">读写访问</td>
</tr>
<tr>
<td style="text-align:left">sync</td>
<td style="text-align:left">所有数据在请求时写入共享</td>
</tr>
<tr>
<td style="text-align:left">async</td>
<td style="text-align:left">nfs在写入数据前可以响应请求</td>
</tr>
<tr>
<td style="text-align:left">secure</td>
<td style="text-align:left">nfs通过1024以下的安全TCP/IP端口发送</td>
</tr>
<tr>
<td style="text-align:left">insecure</td>
<td style="text-align:left">nfs通过1024以上的端口发送</td>
</tr>
<tr>
<td style="text-align:left">wdelay</td>
<td style="text-align:left">如果多个用户要写入nfs目录，则归组写入（默认）</td>
</tr>
<tr>
<td style="text-align:left">no_wdelay</td>
<td style="text-align:left">如果多个用户要写入nfs目录，则立即写入，当使用async时，无需此设置</td>
</tr>
<tr>
<td style="text-align:left">hide</td>
<td style="text-align:left">在nfs共享目录中不共享其子目录</td>
</tr>
<tr>
<td style="text-align:left">no_hide</td>
<td style="text-align:left">共享nfs目录的子目录</td>
</tr>
<tr>
<td style="text-align:left">subtree_check</td>
<td style="text-align:left">如果共享/usr/bin之类的子目录时，强制nfs检查父目录的权限（默认）</td>
</tr>
<tr>
<td style="text-align:left">no_subtree_check</td>
<td style="text-align:left">不检查父目录权限</td>
</tr>
<tr>
<td style="text-align:left">all_squash</td>
<td style="text-align:left">共享文件的UID和GID映射匿名用户anonymous，适合公用目录</td>
</tr>
<tr>
<td style="text-align:left">no_all_squash</td>
<td style="text-align:left">保留共享文件的UID和GID（默认）</td>
</tr>
<tr>
<td style="text-align:left">root_squash</td>
<td style="text-align:left">root用户的所有请求映射成如anonymous用户一样的权限（默认）</td>
</tr>
<tr>
<td style="text-align:left">no_root_squash</td>
<td style="text-align:left">root用户具有根目录的完全管理访问权限</td>
</tr>
<tr>
<td style="text-align:left">anonuid=xxx</td>
<td style="text-align:left">指定nfs服务器/etc/passwd文件中匿名用户的UID</td>
</tr>
<tr>
<td style="text-align:left">anongid=xxx</td>
<td style="text-align:left">指定nfs服务器/etc/passwd文件中匿名用户的GID</td>
</tr>
</tbody>
</table>
<ul>
<li>注1：尽量指定IP段最小化授权可以访问NFS 挂载的资源的客户端</li>
<li>注2：经测试参数insecure必须要加，否则客户端挂载出错mount.nfs: access denied by server while mounting</li>
</ul>
</li>
</ul>
<h3 id="启动NFS服务">启动NFS服务</h3>
<ul>
<li>
<p>配置完成后，您可以在终端提示符后运行以下命令来启动 NFS 服务器：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">systemctl enable nfs-server</span><br><span class="line">systemctl start nfs-server</span><br></pre></td></tr></table></figure>
</li>
</ul>
<h3 id="检查NFS服务提供是否正常">检查NFS服务提供是否正常</h3>
<ul>
<li>
<p>到客户机上执行showmount命令进行检查</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$ showmount -e &lt;NFS服务器IP地址&gt;</span><br><span class="line">Exports list on &lt;NFS服务器IP地址&gt;:</span><br><span class="line">&#x2F;u01</span><br></pre></td></tr></table></figure>
<p><img src="https://gitee.com/zuori/kaiscript/raw/master/images/20210318000250.png" alt=""></p>
</li>
</ul>
<h3 id="添加choerodon-chart仓库">添加choerodon chart仓库</h3>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">helm repo add c7n https:&#x2F;&#x2F;openchart.choerodon.com.cn&#x2F;choerodon&#x2F;c7n&#x2F;</span><br><span class="line">helm repo update</span><br></pre></td></tr></table></figure>
<h3 id="安装StorageClass">安装StorageClass</h3>
<p>在任意一个master节点执行下面helm命令，安装<code>nfs-client-provisioner</code></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">helm upgrade --install nfs-client-provisioner c7n&#x2F;nfs-client-provisioner \</span><br><span class="line">    --set rbac.create&#x3D;true \</span><br><span class="line">    --set persistence.enabled&#x3D;true \</span><br><span class="line">    --set storageClass.name&#x3D;nfs-provisioner \</span><br><span class="line">    --set persistence.nfsServer&#x3D;172.22.2.222 \</span><br><span class="line">    --set persistence.nfsPath&#x3D;&#x2F;u01&#x2F;nfs \</span><br><span class="line">    --version 0.1.1 \</span><br><span class="line">    --namespace kube-system</span><br></pre></td></tr></table></figure>
<p>提供NFS服务的主机IP地址或域名</p>
<p>NFS服务共享的目录</p>
<p><img src="https://gitee.com/zuori/kaiscript/raw/master/images/20210318000840.png" alt=""></p>
<h3 id="标记-StorageClass-为默认的">标记 StorageClass 为默认的</h3>
<p>需要设置一个默认的StorageClass，这个默认的 StorageClass 以后将被用于动态的为没有特定存储类需求的 PersistentVolumeClaims 配置存储。</p>
<p>默认 StorageClass 以 <code>(default)</code> 标记。</p>
<p>你需要添加/设置注解 <code>storageclass.kubernetes.io/is-default-class=true</code>。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">kubectl patch storageclass nfs-provisioner -p <span class="string">&#x27;&#123;&quot;metadata&quot;: &#123;&quot;annotations&quot;:&#123;&quot;storageclass.kubernetes.io/is-default-class&quot;:&quot;true&quot;&#125;&#125;&#125;&#x27;</span></span><br></pre></td></tr></table></figure>
<p>请注意，最多只能有一个 StorageClass 能够被标记为默认。 如果它们中有两个或多个被标记为默认，Kubernetes 将忽略这个注解， 也就是它将表现为没有默认 StorageClass。</p>
<p>验证你选用的 StorageClass 为默认的：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">kubectl get storageclass</span><br></pre></td></tr></table></figure>
<p>输出类似这样：</p>
<p><img src="https://gitee.com/zuori/kaiscript/raw/master/images/20210318002235.png" alt=""></p>
<p>nfs之后有default，表示设置成功。</p>
<h3 id="标记默认-StorageClass-非默认：">标记默认 StorageClass 非默认：</h3>
<p>默认 StorageClass 的注解 <code>storageclass.kubernetes.io/is-default-class</code> 设置为 <code>true</code>。 注解的其它任意值或者缺省值将被解释为 <code>false</code>。</p>
<p>要标记一个 StorageClass 为非默认的，你需要改变它的值为 <code>false</code>：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">kubectl patch storageclass standard -p <span class="string">&#x27;&#123;&quot;metadata&quot;: &#123;&quot;annotations&quot;:&#123;&quot;storageclass.kubernetes.io/is-default-class&quot;:&quot;false&quot;&#125;&#125;&#125;&#x27;</span></span><br></pre></td></tr></table></figure>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">张十三</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="http://zuori.gitee.io/zaker/2021/02/25/%E9%85%8D%E7%BD%AEStorageClass/">http://zuori.gitee.io/zaker/2021/02/25/%E9%85%8D%E7%BD%AEStorageClass/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://zuori.gitee.io/zaker" target="_blank">十三不知</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/zaker/tags/Kubernetes/">Kubernetes</a><a class="post-meta__tags" href="/zaker/tags/%E6%96%87%E4%BB%B6%E6%8C%82%E8%BD%BD/">文件挂载</a></div><div class="post_share"><div class="addthis_inline_share_toolbox"></div><script src="//s7.addthis.com/js/300/addthis_widget.js#pubid=null" async="async"></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/zaker/2021/02/25/Rancher%E7%9A%84%E9%AB%98%E5%8F%AF%E7%94%A8%E5%AE%89%E8%A3%85/"><img class="prev-cover" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="onerror=null;src='/zaker/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">Rancher的高可用部署</div></div></a></div><div class="next-post pull-right"><a href="/zaker/2020/10/08/%E5%BE%AE%E6%9C%8D%E5%8A%A1%E7%9A%84%E5%8F%91%E5%B8%83%E6%96%B9%E5%BC%8F/"><img class="next-cover" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="onerror=null;src='/zaker/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">微服务的发布方式</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span> 相关推荐</span></div><div class="relatedPosts-list"><div><a href="/zaker/2021/03/25/K8s可视化监控之-Weave Scope/" title="Kubernetes集群可视化监控之-Weave Scope"><img class="cover" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-03-25</div><div class="title">Kubernetes集群可视化监控之-Weave Scope</div></div></a></div><div><a href="/zaker/2021/02/25/Rancher的高可用安装/" title="Rancher的高可用部署"><img class="cover" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-02-25</div><div class="title">Rancher的高可用部署</div></div></a></div><div><a href="/zaker/2019/04/25/YAML语法/" title="YAML语法简介"><img class="cover" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2019-04-25</div><div class="title">YAML语法简介</div></div></a></div><div><a href="/zaker/2021/03/03/Kubectl基本使用/" title="kubectl 基本使用"><img class="cover" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-03-03</div><div class="title">kubectl 基本使用</div></div></a></div><div><a href="/zaker/2021/03/30/Kubernetes集群监控之 Metrics Server/" title="Kubernetes集群监控之 Metrics Server"><img class="cover" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-03-30</div><div class="title">Kubernetes集群监控之 Metrics Server</div></div></a></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="card-info-avatar is-center"><img class="avatar-img" src="https://gitee.com/zuori/kaiscript/raw/master/images/20210325192506.jpg" onerror="this.onerror=null;this.src='/zaker/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">张十三</div><div class="author-info__description"></div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/zaker/archives/"><div class="headline">文章</div><div class="length-num">13</div></a></div><div class="card-info-data-item is-center"><a href="/zaker/tags/"><div class="headline">标签</div><div class="length-num">11</div></a></div><div class="card-info-data-item is-center"><a href="/zaker/categories/"><div class="headline">分类</div><div class="length-num">4</div></a></div></div><a class="button--animated" id="card-info-btn" href="http://zuori.gitee.io/zaker"><i class="fab fa-github"></i><span>Follow Me</span></a></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">记录一点东西的地方</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link"><span class="toc-number">1.</span> <span class="toc-text">安装Helm3</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%83%A8%E7%BD%B2%E5%AE%A2%E6%88%B7%E7%AB%AF"><span class="toc-number">1.1.</span> <span class="toc-text">部署客户端</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%AA%8C%E8%AF%81%E9%83%A8%E7%BD%B2"><span class="toc-number">1.2.</span> <span class="toc-text">验证部署</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link"><span class="toc-number">2.</span> <span class="toc-text">建立StorageClass</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA-NFS-%E6%9C%8D%E5%8A%A1%E5%99%A8"><span class="toc-number">2.1.</span> <span class="toc-text">创建 NFS 服务器</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%89%E8%A3%85nfs-utils"><span class="toc-number">2.1.1.</span> <span class="toc-text">安装nfs-utils</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AEnfs-server"><span class="toc-number">2.1.2.</span> <span class="toc-text">配置nfs-server</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%90%AF%E5%8A%A8NFS%E6%9C%8D%E5%8A%A1"><span class="toc-number">2.1.3.</span> <span class="toc-text">启动NFS服务</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%A3%80%E6%9F%A5NFS%E6%9C%8D%E5%8A%A1%E6%8F%90%E4%BE%9B%E6%98%AF%E5%90%A6%E6%AD%A3%E5%B8%B8"><span class="toc-number">2.1.4.</span> <span class="toc-text">检查NFS服务提供是否正常</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%B7%BB%E5%8A%A0choerodon-chart%E4%BB%93%E5%BA%93"><span class="toc-number">2.1.5.</span> <span class="toc-text">添加choerodon chart仓库</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%89%E8%A3%85StorageClass"><span class="toc-number">2.1.6.</span> <span class="toc-text">安装StorageClass</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%A0%87%E8%AE%B0-StorageClass-%E4%B8%BA%E9%BB%98%E8%AE%A4%E7%9A%84"><span class="toc-number">2.1.7.</span> <span class="toc-text">标记 StorageClass 为默认的</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%A0%87%E8%AE%B0%E9%BB%98%E8%AE%A4-StorageClass-%E9%9D%9E%E9%BB%98%E8%AE%A4%EF%BC%9A"><span class="toc-number">2.1.8.</span> <span class="toc-text">标记默认 StorageClass 非默认：</span></a></li></ol></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/zaker/2021/03/30/Kubernetes%E9%9B%86%E7%BE%A4%E7%9B%91%E6%8E%A7%E4%B9%8B%20Metrics%20Server/" title="Kubernetes集群监控之 Metrics Server"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/zaker/img/404.jpg'" alt="Kubernetes集群监控之 Metrics Server"/></a><div class="content"><a class="title" href="/zaker/2021/03/30/Kubernetes%E9%9B%86%E7%BE%A4%E7%9B%91%E6%8E%A7%E4%B9%8B%20Metrics%20Server/" title="Kubernetes集群监控之 Metrics Server">Kubernetes集群监控之 Metrics Server</a><time datetime="2021-03-30T06:46:36.000Z" title="发表于 2021-03-30 14:46:36">2021-03-30</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/zaker/2021/03/26/RabbitMq%E5%9F%BA%E7%A1%80%E4%BD%BF%E7%94%A8/" title="RabbitMq学习笔记"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/zaker/img/404.jpg'" alt="RabbitMq学习笔记"/></a><div class="content"><a class="title" href="/zaker/2021/03/26/RabbitMq%E5%9F%BA%E7%A1%80%E4%BD%BF%E7%94%A8/" title="RabbitMq学习笔记">RabbitMq学习笔记</a><time datetime="2021-03-26T01:46:36.000Z" title="发表于 2021-03-26 09:46:36">2021-03-26</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/zaker/2021/03/25/K8s%E5%8F%AF%E8%A7%86%E5%8C%96%E7%9B%91%E6%8E%A7%E4%B9%8B-Weave%20Scope/" title="Kubernetes集群可视化监控之-Weave Scope"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/zaker/img/404.jpg'" alt="Kubernetes集群可视化监控之-Weave Scope"/></a><div class="content"><a class="title" href="/zaker/2021/03/25/K8s%E5%8F%AF%E8%A7%86%E5%8C%96%E7%9B%91%E6%8E%A7%E4%B9%8B-Weave%20Scope/" title="Kubernetes集群可视化监控之-Weave Scope">Kubernetes集群可视化监控之-Weave Scope</a><time datetime="2021-03-25T11:46:36.000Z" title="发表于 2021-03-25 19:46:36">2021-03-25</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/zaker/2021/03/25/Linux%E5%B0%86%E6%99%AE%E9%80%9A%E7%94%A8%E6%88%B7%E5%8A%A0%E5%85%A5sudo%E7%BB%84/" title="Linux将一般用户加入sudo组"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/zaker/img/404.jpg'" alt="Linux将一般用户加入sudo组"/></a><div class="content"><a class="title" href="/zaker/2021/03/25/Linux%E5%B0%86%E6%99%AE%E9%80%9A%E7%94%A8%E6%88%B7%E5%8A%A0%E5%85%A5sudo%E7%BB%84/" title="Linux将一般用户加入sudo组">Linux将一般用户加入sudo组</a><time datetime="2021-03-25T11:46:36.000Z" title="发表于 2021-03-25 19:46:36">2021-03-25</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/zaker/2021/03/03/Kubectl%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8/" title="kubectl 基本使用"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/zaker/img/404.jpg'" alt="kubectl 基本使用"/></a><div class="content"><a class="title" href="/zaker/2021/03/03/Kubectl%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8/" title="kubectl 基本使用">kubectl 基本使用</a><time datetime="2021-03-03T11:46:36.000Z" title="发表于 2021-03-03 19:46:36">2021-03-03</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2021 By 张十三</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/zaker/js/utils.js"></script><script src="/zaker/js/main.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"></div><script defer="defer" id="ribbon" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-ribbon.min.js" size="150" alpha="0.6" zIndex="-1" mobile="false" data-click="false"></script><script defer="defer" id="fluttering_ribbon" mobile="true" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js"></script><script id="canvas_nest" defer="defer" color="0,0,255" opacity="0.7" zIndex="-1" count="99" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-nest.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>